﻿@model Hrm.Core.BlogPost
@{
    ViewBag.Title = "BlogItem";
    Layout = "~/Views/Shared/_FrontLayout.cshtml";
}
<div id="content">
    <section id="topbar">
        <div class="container">
            <div class="row">
                <div class="col-md-6">
                    <h1>博文</h1>
                </div>
                <div class="col-md-6 text-right">
                    <ul class="breadcrumb">
                        <li>
                            <a href="@Url.Action("Index")">首页</a>
                        </li>
                        <li>
                            <a href="@Url.Action("Blog")">博客</a>
                        </li>
                        <li class="active">博文</li>
                    </ul>
                </div>
            </div>
        </div>
    </section>
    <section class="white-bg blog-item">
        <div class="container">
            <div class="col-md-8">
                <div class="blog-post">
                    <h2 class="blog-post-title">@Model.Title</h2>
                    <div class="blog-meta">
                        <span class="date">
                            <a href="#">
                                <i class="fa fa-calendar"></i>
                                @Model.CreateDatetime
                            </a>
                        </span>
                        <span class="seperator">/</span>
                        <span class="author">
                            <a href="#">
                                <i class="fa fa-user"></i>
                                @Model.CreateUserCode
                            </a>
                        </span>
                        <span class="seperator">/</span>
                        <span class="category">
                            <a href="#">
                                @Model.Type
                            </a>
                        </span>
                        <span class="seperator">/</span>
                        <span class="comments">
                            <a href="#commentsAnchor">
                                <i class="fa fa-comments"></i>
                                @Model.BlogComments.Count 个评价
                            </a>
                        </span>
                    </div>
                    <div class="blog-post-content">
                        @Html.Raw(Model.Content)
                        <div class="blog-post-pager">
                            <ul class="pager">
                                <li class="previous">
                                    @{
                                        var preBlog = (Hrm.Core.BlogPost)ViewBag.PreBlog;
                                        if (preBlog != null)
                                        {
                                            <a href="@Url.Action("BlogItem", new { Id = @preBlog.Id })">
                                                <span aria-hidden="true">←</span>@preBlog.Title
                                            </a>
                                        }
                                    }
                                </li>
                                <li class="next">
                                    @{
                                        var nextBlog = (Hrm.Core.BlogPost)ViewBag.NextBlog;
                                        if (nextBlog != null)
                                        {
                                            <a href="@Url.Action("BlogItem", new { Id = @nextBlog.Id })">@nextBlog.Title<span aria-hidden="true">→</span></a>
                                        }
                                    }
                                </li>
                            </ul>
                        </div>
                        <div class="blog-post-comments mt30">
                            <div class="heading mt20 mb30">
                                <h3>评价</h3>
                                <a name="commentsAnchor" id="commentsAnchor">
                                </a>
                            </div>
                            <ul class="blog-post-comments-list">
                                @if (@Model.BlogComments.Count > 0)
                                {
                                    foreach (var item in Model.BlogComments)
                                    {
                                        <li>
                                            <div class="comment">
                                                <div class="comment-author">
                                                    @*<img class="comment-avatar" src="/Images/avatars/3.jpg" alt="avatar">*@
                                                    <strong>@item.EvaluateUser</strong>
                                                </div>
                                                <div class="comment-meta">
                                                    <a href="#" title="#">@item.CreateDatetime</a>
                                                </div>
                                                <p class="comment-text">
                                                    @item.CommentText
                                                </p>
                                                <div class="comment-reply">
                                                    <a href="javascript:void(0);" class="btn btn-default btnReply"><i class="fa fa-reply"></i> 回复</a>
                                                </div>
                                            </div>
                                        </li>
                                    }
                                }
                                else
                                {
                                    <li>
                                        <div class="comment">
                                            <p>暂无评价内容！</p>
                                        </div>
                                    </li>
                                }

                            </ul>
                            <div class="row">
                                <!-- .row start -->
                                <div class="col-md-12">
                                    <div class="heading mt20 mb30">
                                        <h3>评价</h3>
                                    </div>
                                    <form class="form-horizontal" method="post" action="@Url.Action("BlogItem")" role="form">
                                        @Html.Hidden("BlogPost.Id", @Model.Id)
                                        @Html.AntiForgeryToken()
                                        @Html.ValidationSummary(true, "", new { @class = "text-danger" })
                                        <div class="form-group">
                                            <div class="col-lg-12">
                                                <div class="row">
                                                    <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
                                                        @Html.TextBox("EvaluateUser", @String.IsNullOrEmpty(User.Identity.Name) ? "过客" : @User.Identity.Name, new { @class = "form-control", @readonly = "readonly", placeholder = "名字" })
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="col-lg-12">
                                                @Html.TextArea("CommentText", null, new { @class = "form-control", rows = "3", placeholder = "内容" })
                                                @Html.ValidationMessage("CommentText", new { @class = "text-danger" })
                                            </div>
                                        </div>
                                        <!-- End .form-group  -->
                                        <div class="form-group">
                                            <div class="col-lg-12">
                                                <div class="row">
                                                    <!-- Start .row -->
                                                    <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
                                                        <button type="submit" class="btn btn-default btn-lg">提交</button>
                                                    </div>
                                                </div>
                                                <!-- End .row -->
                                            </div>
                                        </div>
                                        <!-- End .form-group  -->
                                    </form>
                                </div>
                                <!-- col-md-12 end here -->
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="sidebar sidebar-right col-md-4">
                @Html.Action("PartViewPopularBlogs")
                @Html.Action("PartViewTagsCloud")

            </div>
        </div>
    </section>
</div>
@section JavascriptSection{
}

